package com.ls.fw.token.support;

import org.springframework.util.Assert;

@SuppressWarnings("serial")
public final class DefaultToken implements Token {

	private final String token;

	private final String parameterName;

	private final String headerName;

	/**
	 * Creates a new instance
	 * @param headerName the HTTP header name to use
	 * @param parameterName the HTTP parameter name to use
	 * @param token the value of the token (i.e. expected value of the HTTP parameter of
	 * parametername).
	 */
	public DefaultToken(String headerName, String parameterName, String token) {
		Assert.hasLength(headerName, "headerName cannot be null or empty");
		Assert.hasLength(parameterName, "parameterName cannot be null or empty");
		Assert.hasLength(token, "token cannot be null or empty");
		this.headerName = headerName;
		this.parameterName = parameterName;
		this.token = token;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.ls.fw.token.support.Token#getHeaderName()
	 */
	public String getHeaderName() {
		return headerName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.ls.fw.token.support.Token#getParameterName()
	 */
	public String getParameterName() {
		return parameterName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.ls.fw.token.support.Token#getToken()
	 */
	public String getToken() {
		return token;
	}
}
